<extend name="Public:base"/>

<block name="main">
    <script>
        function edittpl(){
            var file= $('#tpl').val();
            url = "{:U('slide/edittpl')}&isajax=1&tpl="+file
            openwin("edittpl",url,"{:L(EDIT_TPL)}",700,550,true);
        }
    </script>

    <div id="yzh-content" class="col-xs-12">
        <div class="main-title">
            <h2>新增广告</h2>
        </div>

        <div class="dataTables_wrapper">
            <form name="myform" id="myform" class="form-horizontal" action="{:U('Slide/add')}" method="post">
                <div class="form-group">
                    <label class="control-label col-md-2"><font color="red">*</font>{:L(name)}</label>
                        <div><input type="text" id="name" name="name" value="{$vo.name}" class="input-text"  validate="required:true,cn_username:true, minlength:2, maxlength:20"/></div>

</div>
                    <div class="form-group">
                        <label class="control-label col-md-2">幻灯片模板</label>
                        <div>{:Form::select(array('field'=>'tpl','options'=>$Tpl,'options_key'=>'value,filename'),$vo['tpl'])} <a href="javascript:void(0);" onclick='edittpl();'>{:L(EDIT_TPL)}</a></div>
                    </div>

                    <div class="form-group">
                        <label class="control-label col-md-2">{:L(xmlfile)}</label>
                        <div><input type="text" id="xmlfile" name="xmlfile" value="{$vo.xmlfile}" class="input-text"/></div>
                    </div>

                    <div class="form-group">
                        <label class="control-label col-md-2">{:L(width)}</label>
                        <div><input type="text" id="width" name="width" value="{$vo.width}" class="input-text" validate="required:true,number:true, minlength:1, maxlength:20"/></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-2">{:L(height)}</label>
                        <div><input type="text" id="height" name="height" value="{$vo.height}" class="input-text" validate="required:true,number:true, minlength:1, maxlength:20"/></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-2">{:L(num)}</label>
                        <div><input type="text" id="height" name="num" value="{$vo.num}" class="input-text" /></div>
                    </div>
                    <div>
                        <label>{:L(STATUS)}</label>
                        <div>{:Form::radio(array('field'=>'status','options'=>array('1'=>L('enable'),'0'=>L('disable'))),$vo['status'])}</div>
                    </div>

                <div  class="form-actions">
                    <if condition="$vo['id']!=''"><input type="hidden" name="id" value="{$vo.id}"/></if>
                    <input type="submit" value="确认" class="btn btn-sm btn-primary" />
                    <a href="{:U('Slide/index')}" class="btn btn-sm btn-primary">返回广告列表</a>
                </div>
            </form>
        </div>
</block>